package com.example._05mvcboot03.common.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    public JsonResult(StatesCode statesCode) {
        this.state=statesCode.getState();
        this.message=statesCode.getMessage();
    }

    public JsonResult(StatesCode statesCode,Object data) {
        this.state=statesCode.getState();
        this.message=statesCode.getMessage();
        this.data=data;
    }
    public static JsonResult ok(Object data){
        return new JsonResult(StatesCode.OPERATION_SUCCESS,data);
    }
    public static JsonResult ok(){
        return new JsonResult(StatesCode.OPERATION_SUCCESS,null);
    }

    private Integer state;
    private String message;
    private Object data;
}
